package com.jar.exercise.多线程.线程池.threadpool;

import java.util.concurrent.*;

/**
 * 拒绝策略使用
 */
public class NewFixedThreadPool {
	public static void main(String[] args) {
		ExecutorService executorService = Executors.newFixedThreadPool(3);

		for (int i = 0; i < 10; i++) {
			executorService.submit(() -> {
				try {
					System.out.println(Thread.currentThread().getName() + ":::->正在被执行");
					Thread.sleep(10000);
				} catch (InterruptedException e) {
					e.printStackTrace();
				}

			});

		}
		executorService.shutdown();
	}
}
